//
//  NewMoreViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/15.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewMoreViewController.h"
#import "JTCSM.h"
#import "MyInfoView.h"
#import "TypeView.h"
#import "HomePageModel.h"
#import "NewYiJianFanKuiViewController.h"

static CGFloat myinfoHeight = 50;
@interface NewMoreViewController ()
{
    UIScrollView *backScrollV;
}
@end

@implementation NewMoreViewController

- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [df isRemoveTarbar:YES];
    self.navigationController.navigationBar.hidden = NO;
    self.view.backgroundColor =[UIColor whiteColor];
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    backScrollV = [[UIScrollView alloc]initWithFrame:CGRectMake(0, KagainChangeHeight, KCONTROLLERWith, KCONTROLLERHeight)];
    backScrollV.backgroundColor = RGBACOLOR(241, 241, 241, 1);
    backScrollV.userInteractionEnabled = YES;
    backScrollV.bounces = NO;
    backScrollV.showsVerticalScrollIndicator = NO;
    [self.view addSubview:backScrollV];
    [self layoutMyinfoView];
}
- (void)layoutMyinfoView{
    
    CGFloat headerViewHeight = 150;
    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KCONTROLLERWith, headerViewHeight)];
    headerView.backgroundColor = [UIColor whiteColor];
    [backScrollV addSubview:headerView];
    
    TypeView *view;
    NSArray *titleArray = @[@"常见问题",@"意见反馈",@"关于我们"];
    NSArray *imageArray = @[@"更多服务_常见问题.png",@"更多服务_意见反馈.png",@"更多服务_关于我们.png"];
    NSMutableArray *typearray = [NSMutableArray arrayWithCapacity:2];
    for (int i = 0; i <titleArray.count; i++) {
        HomePageModel *model = [[HomePageModel alloc]init];
        model.titleStr = titleArray[i];
        model.imagename = imageArray[i];
        [typearray addObject:model];
    }
    CGFloat spaceofLeft = 30;
    CGFloat typeviewSize = (KCONTROLLERWith-4*spaceofLeft)/3;
    CGFloat top = (headerViewHeight - typeviewSize)/2;
    for (int i = 0 ; i<typearray.count; i++) {
        
        view= [[TypeView alloc]initWithFrame:CGRectMake(spaceofLeft+(typeviewSize+spaceofLeft)*i,top, typeviewSize, typeviewSize) TypeViewType:headerType];
        HomePageModel *model = typearray[i];
        [view setvalueWithModel:model];
        view.tag = 2000+i;
        view.userInteractionEnabled = YES;
        [df addTapGestureRecognizerWithTarget:self action:@selector(gotoVC:) andaddView:view];
        [headerView addSubview:view];
    }
    
    
    NSArray *array = @[@"官网",@"微信公众号",@"微博"];
    
    NSArray *array1 = @[@"客服热线"];
    
    [df lineViewWithHeightofTop:10+headerViewHeight superView:backScrollV spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:10];
    for (int i = 0; i < array.count; i++) {
        MyInfoView *view1 = [[MyInfoView alloc]initWithFrame:CGRectMake(0, 10+headerViewHeight+myinfoHeight*i, KCONTROLLERWith, myinfoHeight) imagename:nil title:array[i] placeholder:nil isShowLabel:ImageViewType radioBtnIndex:0 GroupId:@""];
        view1.tag = 100+i;
        view1.userInteractionEnabled = YES;
        [df addTapGestureRecognizerWithTarget:self action:@selector(gotoVC:) andaddView:view1];
        [backScrollV addSubview:view1];
        
    }
    [df lineViewWithHeightofTop:myinfoHeight*array.count+20 superView:backScrollV spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:10];
    for (int i = 0; i < array1.count; i++) {
        MyInfoView *view2 = [[MyInfoView alloc]initWithFrame:CGRectMake(0, myinfoHeight*array.count+headerViewHeight+20+myinfoHeight*i, KCONTROLLERWith, myinfoHeight) imagename:nil title:array1[i] placeholder:nil isShowLabel:ImageViewType radioBtnIndex:0 GroupId:@""];
        view2.tag = 102+i;
        view2.userInteractionEnabled = YES;
        [df addTapGestureRecognizerWithTarget:self action:@selector(gotoVC:) andaddView:view2];
        [backScrollV addSubview:view2];
    }
}

- (void)gotoVC:(UITapGestureRecognizer *)tap{
    switch (tap.view.tag) {
        case 2001:
            [self gotoNewYiJianFanKuiVC];
            break;
            
        default:
            break;
    }
}
- (void)gotoNewYiJianFanKuiVC{
    NewYiJianFanKuiViewController *vc = [[NewYiJianFanKuiViewController alloc]init];
    vc.nameTitle = @"意见反馈";
    [self.navigationController pushViewController:vc animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
